import { defineStore } from "pinia";
import { getNews } from "@/api/news";

const init = {};

export const useNewsStore = defineStore("news", {
  state: () => ({ ...init }),
  actions: {
    async news() {
      const {
        data: { newsList },
      } = await getNews();
      return newsList;
    },
  },
  persist: {
    enabled: true,
    detached: true, // 设置订阅与组件分离
  },
});
